home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Quill / Source / MacControlEditor.cpp < prev    next >
Text File  |  1997-05-11  |  4KB  |  129 lines

  1. /*
  2.  *  File:       MacControlEditor.cpp
  3.  *  Summary:       A view that knows how to edit a TMacControl.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1996 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *  Change History (most recent first):    
  10.  *
  11.  *         <->    11/01/96    JDJ        Created
  12.  */
  13.  
  14. #include "MacControlEditor.h"
  15.  
  16. #include <ZTextBox.h>
  17.  
  18. #include "RsrcPopupMenu.h"
  19.  
  20.  
  21. // ===================================================================================
  22. //    class CEditMacControlCommand
  23. // ===================================================================================
  24.  
  25. //---------------------------------------------------------------
  26. //
  27. // CEditMacControlCommand::~CEditMacControlCommand
  28. //
  29. //---------------------------------------------------------------
  30. CEditMacControlCommand::~CEditMacControlCommand()
  31. {
  32. }
  33.  
  34.  
  35. //---------------------------------------------------------------
  36. //
  37. // CEditMacControlCommand::CEditMacControlCommand
  38. //
  39. //---------------------------------------------------------------
  40. CEditMacControlCommand::CEditMacControlCommand(TMacControl* pane, const SMacControlInfo& oldInfo, const SMacControlInfo& newInfo) : Inherited(pane, oldInfo, newInfo)
  41. {
  42. }
  43.  
  44.  
  45. //---------------------------------------------------------------
  46. //
  47. // CEditMacControlCommand::UpdatePane
  48. //
  49. //---------------------------------------------------------------
  50. void CEditMacControlCommand::UpdatePane(const SMacControlInfo& info)
  51. {
  52.     mPane->SetTitle(info.title);
  53.     mPane->SetTextTraits(info.traitsID);
  54. }
  55.  
  56. #pragma mark -
  57.  
  58. // ===================================================================================
  59. //    CMacControlEditor
  60. // ===================================================================================
  61.  
  62. static TReanimatorRegister<CMacControlEditor> sCaptionEditorRegistrar;
  63.  
  64. //---------------------------------------------------------------
  65. //
  66. // CMacControlEditor::~CMacControlEditor
  67. //
  68. //---------------------------------------------------------------
  69. CMacControlEditor::~CMacControlEditor()
  70. {
  71. }
  72.  
  73.  
  74. //---------------------------------------------------------------
  75. //
  76. // CMacControlEditor::CMacControlEditor
  77. //
  78. //---------------------------------------------------------------
  79. CMacControlEditor::CMacControlEditor(TView* superView) : Inherited(superView)
  80. {
  81. }
  82.  
  83.  
  84. //---------------------------------------------------------------
  85. //
  86. // CMacControlEditor::Create                                [static]
  87. //
  88. //---------------------------------------------------------------
  89. MReanimatable* CMacControlEditor::Create(MReanimatable* parent)
  90. {
  91.     return new CMacControlEditor(dynamic_cast<TView*>(parent));
  92. }
  93.  
  94.  
  95. //---------------------------------------------------------------
  96. //
  97. // CMacControlEditor::GetEditorInfo        
  98. //
  99. //---------------------------------------------------------------
  100. SMacControlInfo CMacControlEditor::GetEditorInfo() const
  101. {
  102.     SMacControlInfo info;
  103.             
  104.     TTextBox* textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Control Title"));
  105.     info.title = textBox->GetText();
  106.     
  107.     CRsrcPopupMenu* popup = dynamic_cast<CRsrcPopupMenu*>(this->FindSubPane("Traits ID"));
  108.     info.traitsID = popup->GetID();
  109.     
  110.     return info;
  111. }
  112.  
  113.  
  114. //---------------------------------------------------------------
  115. //
  116. // CMacControlEditor::SetEditorInfo
  117. //
  118. //---------------------------------------------------------------
  119. void CMacControlEditor::SetEditorInfo(const SMacControlInfo& info)
  120. {    
  121.     TTextBox* textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Control Title"));
  122.     textBox->SetText(info.title);
  123.     
  124.     CRsrcPopupMenu* popup = dynamic_cast<CRsrcPopupMenu*>(this->FindSubPane("Traits ID"));
  125.     popup->SetID(info.traitsID);
  126. }
  127.  
  128.  
  129.